package com.itheima.schedule;

import com.itheima.service.NoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * <h1>通知定时器</h1>
 *
 * @author <a href="515857087@qq.com">叶世铭</a>
 * @since 2022/12/8
 */
@Component
@Slf4j
public class NoticeSchedule {

    @Resource
    private NoticeService noticeService;

    /**
     * 5min执行一次
     * 查找有未读通知的用户并给用户发送短信通知
     */
//    @Scheduled(fixedDelay = 5 * 60 * 1000)
    @Scheduled(cron = "0 0 8 * * ?")
    public void remindUser() throws Exception {
//        noticeService.remindUser();
        log.info("短信通知完成," + LocalDateTime.now());
    }
}

